package com.riddle.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.riddle.dao.BaseDao;
import com.riddle.dao.UserDao;
import com.riddle.model.Role;
import com.riddle.model.User;
import com.riddle.vmodel.ValuePair;

@Service
@Scope("prototype")  
public class UserService extends BaseService<User> {

	@Resource
	private UserDao userDao;
	
	protected  BaseDao getDao() {
		return userDao;
	}
	
	public User getUserWithRole(Long id){
		return userDao.getUserWithRole(id);
	}
	
	public void deleteUserRole(Long id) {
		userDao.deleteUserRole(id);
	}
	
	public void saveUserRole(List<ValuePair<Long, String>> list) {
		userDao.saveUserRole(list);
	}
	
	public boolean check(String name, String password) {
		return userDao.check(name, password);
	}
	
	public User getUser(String name) {
		return userDao.getUser(name);
	}
	
	public User getUserWithRoleAndPermission(String name) {
		return userDao.getUserWithRoleAndPermission(name);
	}
}